<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/web/header.jsp" %>
<title>登录页面</title>
</head>
<body>
<div class="breadcrumb-area">
            <div class="container">
                <div class="row">
                    <div class="col-12">
                        <div class="breadcrumb-wrap">
                            <nav aria-label="breadcrumb">
                                <ul class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="<%=app %>/web/front/index.jsp">返回首页</a></li>
                                    <li class="breadcrumb-item active" aria-current="page">用户登录</li>
                                </ul>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- breadcrumb area end -->

        <!-- login register wrapper start -->
        <div class="login-register-wrapper">
            <div class="container">
                <div class="member-area-from-wrap">
                    <div class="row">
                        <!-- Login Content Start -->
                        <div class="col-lg-6">
                            <div class="login-reg-form-wrap  pr-lg-50">
                                <h2>登录</h2>
<!--                                 action=""  -->
                                <form method="post">
                                    <div class="single-input-item">
                                        <input type="text" name="code" placeholder="输入你的账号" required />
                                    </div>
                                    <div class="single-input-item">
                                        <input type="password" name="pass" placeholder="输入你 的密码" required />
                                    </div>
                                    <div class="single-input-item">
                                        <div class="login-reg-form-meta d-flex align-items-center justify-content-between">
                                            <div class="remember-meta">
                                                <div class="custom-control custom-checkbox">
                                                    <input type="checkbox" class="custom-control-input" id="rememberMe">
                                                    <label class="custom-control-label" for="rememberMe">同意获取相关信息</label>
                                                </div>
                                            </div>
                                            <a href="javascript:;" class="forget-pwd" onclick="lose()">忘记密码?</a>
                                        </div>
                                    </div>
                                    <div class="single-input-item">
                                        <button class="sqr-btn" onclick="logins()">登录</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<!--                                         <button class="sqr-btn" >前往注册</button> -->
                                        	未有账号？→&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=app %>/web/front/register.jsp" class="btn btn-info" role="button" >马上注册</a>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <!-- Login Content End -->

                    </div>
                </div>
            </div>
        </div>
        
        <!--All jQuery, Third Party Plugins & Activation (main.js) Files-->
    	<script src="<%=app %>/web/base/assets/js/vendor/modernizr-3.6.0.min.js"></script>
    	<!-- Jquery Min Js -->
    	<script src="<%=app %>/web/base/assets/js/vendor/jquery-3.3.1.min.js"></script>
    	<!-- Popper Min Js -->
    	<script src="<%=app %>/web/base/assets/js/vendor/popper.min.js"></script>
    	<!-- Bootstrap Min Js -->
    	<script src="<%=app %>/web/base/assets/js/vendor/bootstrap.min.js"></script>
    	<!-- Plugins Js-->
	    <script src="<%=app %>/web/base/assets/js/plugins.js"></script>
	    <!-- Ajax Mail Js -->
	    <script src="<%=app %>/web/base/assets/js/ajax-mail.js"></script>
	    <!-- Active Js -->
	    <script src="<%=app %>/web/base/assets/js/main.js"></script>
	    <!-- Switcher JS [Please Remove this when Choose your Final Projct] -->
        
        
        <script type="text/javascript">
        	function logins(){
        		var code = $("input[name='code']").val();
        		var pass = $("input[name='pass']").val();
        		$.ajax({
        			url:"<%=app %>/roots/login.do",
        			data:{
        				"code":code,
        				"pass":pass
        			},
        			type:"post",
        			success:function(data){
        				console.log(data)
        				if(data=="1"){
        					alert("登录成功")
//         					alert(code)
        					location.href = "<%=app %>/web/front/index.jsp?zhanghao="+code+"";
        				}else if(data=="2"){
        					alert("密码错误")
        					location.href = "<%=app %>/web/front/login.jsp";
        				}else if(data=="0"){
        					alert("账号不存在")
        					location.href = "<%=app %>/web/front/login.jsp";
        				}
        			}
        		})
        	}
        	
        	function lose(){
        		alert("暂时无法修改密码")
        	}
        </script>
</body>
</html>